package com.job.oppo;

import java.lang.reflect.Array;
import java.util.Arrays;

/**
 * @author angzhijin
 * @Description
 * @create 2022-09-02 8:04 PM
 */
public class OPPO0902 {

    public static void main(String[] args) {

        int[] aaa = aaa(new int[][]{{1234, 1235}, {1236, 1238}});
        System.out.println(Arrays.toString(aaa));

        int[] aaa1 = aaa(new int[][]{{1234, 1240}, {1236, 1238, 1245, 1250}});
        System.out.println(Arrays.toString(aaa1));


    }


        public static int[] aaa(int[][] input){
            int n=input.length;
            double[] tmp = new double[n];
            int[] times = new int[10000000];
            for (int i = 0; i < n; i++) {
                int[] t = input[i];
                int len = t.length;
                for (int j = 0; j < len / 2; j++) {
                    for (int k = t[2*j]+1; k <=t[2*j+1] ; k++) {
                        times[k]++;
                    }
                }
            }
            for (int i = 0; i < n; i++) {
                int[] t = input[i];
                int len = t.length;
                for (int j = 0; j < len / 2; j++) {
                    for (int k = t[2*j]+1; k <=t[2*j+1] ; k++) {
                        tmp[i] += 1.0/times[k];
                    }
                }
            }
            int[] res = new int[n];
            for (int i = 0; i < n; i++) {
                res[i] = (int)tmp[i];
            }
            return res;
        }


}
